#!/usr/bin/env python

# -------------------------------
# projects/python/collatz/main.py
# Copyright (C) 2009
# Glenn P. Downing
# -------------------------------

# To run the program
#     main.py < Collatz.in > Collatz.out

# To document the program
#     pydoc -w main

# -------
# globals
# -------

i = 0 # input: don't change after reading
j = 0 # input: don't change after reading
v = 0 # output
cache ={}# dictionary that holds calculated cycle lengths

# -----------
# InputReader
# -----------

class InputReader (object) :
    def read (self) :
        return raw_input()

# ------------
# OutputWriter
# ------------

class OutputWriter (object) :
    def write (self, *a) :
        for w in a :
            print w,
        print

# -------
# my_read
# -------

def my_read (r) :
    """
    reads an int into i and j
    return true if that succeeds, false otherwise
    """
    global i
    global j
    try :
        s = r.read()
    except EOFError :
        return False
    l = s.split()
    i = int(l[0])
    j = int(l[1])
    return True

# -------
# helper
# -------
def helper (n) :
    """
    computes the cycle length of given number n
    and store result in c
    """
    c = 1  
    while n != 1 :
        if n not in cache:
            if n & 1  == 1 :# if odd
                n= n + (n>>1)+1 # multiply by three and add one
                c=c+2
            else : # if even
                n = n>>1 # divide by two
                c = c+1
        else:
            c = c+cache[n]
            n = 1
    assert n > 0
    return c  # cover the endpoint

# -------
# my_eval
# -------
def my_eval () :
    """
    computes the max cycle length in the range [i, j]
    and stores the result in v
    """
    
    global v
    v = 0
    cache = {}
    for k in xrange(min(i,j),max(i,j)+1):
        assert k > 0
        v = max(v,helper(k))
       # if k not in cache :
        #    cache[k] = helper(k)
         #   assert cache[k] == helper(k)
        #v = max(v, cache[k])
    

# --------
# my_print
# --------

def my_print (w) :
    """
    writes the values of i, j, and v
    """
    w.write(i, j, v)

# ----
# main
# ----

def main () :
    """
    runs the program
    """
    while my_read(InputReader()) :
        my_eval()
        my_print(OutputWriter())

if __name__ == "__main__" :
    main()


